<template>
  <tr>
    <th><input type="checkbox" v-model="obj.checked" /></th>
    <th>{{ obj.name }}</th>
    <th>{{ obj.price }}</th>
    <th>
      <button @click="jian(obj.index)" :disabled="obj.num == 1">-</button>
      <span>{{ obj.num }} </span>
      <button @click="jia(obj.index)">+</button>
    </th>
    <th>{{ obj.price * obj.num }}</th>
    <th><button @click="git(obj.index)">删除</button></th>
  </tr>
</template>

<script>
export default {
  props: ["obj", "index"],
  methods: {
    jia(ind) {
      this.$emit("zheng", ind);
      //   this.obj.num++;
    },
    jian(ind) {
      this.$emit("fu", ind);
      //   this.obj.num > 1 && this.obj.num--;
    },
    git(ind) {
      this.$emit("get", ind);
    },
  },
};
</script>

<style>
</style>